<?php
namespace Common\Model;
use Think\Model;
// 上传图片类
class UploadImageModel extends Model{
	private $_uploadobj = '';
	private $_uploadImageData = '';
	const UPLOAD = 'upload';
	public function __construct()
	{
		$this->_uploadobj = new \Think\Upload();
		$this->_uploadobj->rootPath = './public/'.self::UPLOAD.'/';
		$this->_uploadobj->subName = date(Y).'/'.date(m).'/'.date(d);
	}
	public function upload()
	{
		$res = $this->_uploadobj->upload();
		if($res){
			return './Public/'.self::UPLOAD.'/'.$res['imgFile']['savepath'].$res['imgFile']['savename'];
		}else{
			return false;
		}
	}
	public function imageUpload()
	{
		$res = $this->_uploadobj->upload();
		if($res){
			return  './public/'.self::UPLOAD.'/'.$res['file']['savepath'].$res['file']['savename'];
		}
	}
}